<form name="form" novalidate>
<uib-tabset class="form-horizontal">
    <uib-tab heading="{{item.id?'编辑':'添加'}}用户"  >
        <div class="modal-body " >
            <div class="form-group">
                <label class="col-sm-2 control-label required">账号：</label>
                <div class="col-sm-4">
                    <input type="text"  ng-model="item.account" class="form-control" placeholder="2~20 characters!"
                           required ng-minlength="2" ng-maxlength="20"
                           uib-tooltip="{{item.account && form.account.$invalid?'有重名':null}}" id="{{item.id}}" ensure-unique="account" api="../sys/checkUniqueName_mute"
                           popover-placement="top" popover-trigger="mouseenter">
                </div>
                <label class="col-xs-2 control-label required">登录密码：</label>
                <div class="col-xs-4" uib-popover="6~50 characters!" popover-placement="top" popover-trigger="mouseenter">
                    <input  type="{{passType?'text':'password'}}" ng-model="item.password" class="form-control" placeholder="" required ng-minlength="6" ng-maxlength="50"  >
                    <button class="btn btn-default" style="position: absolute;right:17px;top:1px;height:32px;border:none" ng-click="passType = !passType">
                        <i class="glyphicon" ng-class="{'glyphicon-eye-open':!passType,'glyphicon-eye-close':passType}"></i></button>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label required">昵称：</label>
                <div class="col-sm-4">
                    <input type="text"  ng-model="item.name" class="form-control" required>
                </div>
            </div>
            <table class="table table-bordered table-striped table-hover" style="margin-bottom: 0;" ng-if="item.id!=1">
                <thead>
                <td>菜单</td>
                <td>功能</td>
                <td>全选</td>
                </thead>
                <tbody>
                <tr ng-repeat="menu in categories" >
                    <td><b>{{menu.name}}</b></td>
                    <td>
                <span ng-repeat="ac in menu.powerList" class="mr15 " style="cursor: pointer;"
                      ng-click="toggleAccess(menu.powerList,ac)"><i class="glyphicon"
                                                                    ng-class="getCheckClass(item.powerList,ac)"></i>{{ac}}</span>
                    </td>
                    <td>
                        <i class="glyphicon glyphicon-th btn-link" ng-click="checkAll(menu)" > </i>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </uib-tab>
    <uib-tab heading="授权样式">
        <div class="modal-body">
            <div class="form-group" >
                <label class="col-sm-2 control-label required">选择样式版本：</label>
                <tree-selector style="width: 250px;float:left"  node-list="filteredSceneTree" callback="resetInstance"  leaf-only=true host="temp" host-key="'sceneId'" host-text="'sceneName'"  tip-text="'场景选择'"></tree-selector>
                <div style="display: inline-block;vertical-align: middle;margin-left: 5px">
                    <input type="text" ng-model="temp.obj" placeholder="--样式名称--"
                           uib-typeahead="o as o.name for o in findInstance(temp.sceneId,$viewValue)"
                           class="form-control"
                           typeahead-show-hint="true" typeahead-min-length="0">
                </div>
                <button class="btn btn-sm btn-default" ng-disabled="!temp.obj" ng-click="addInstance(temp)"><i class="glyphicon glyphicon-plus"></i></button>
            </div>

            <div class="well" style="min-height: 200px;overflow-y: auto;padding: 0;margin-bottom:0">
                <ul class="ul-block">
                    <li  ng-repeat="instance in instances">
                        <a ng-click="instance.edit=!instance.edit" ng-class="{'text-success':instance.edit}">
                            <i  class="glyphicon" ng-class="{'glyphicon-eye-open':!instance.edit,'glyphicon-pencil':instance.edit}"></i>
                        {{instance.name}}
                        </a>
                        <a ng-click="instances.splice(instances.indexOf(instance),1)"><i class="fa fa-remove"></i></a></li>
                </ul>
            </div>
        </div>
    </uib-tab>
</uib-tabset>
</form>
<div class="modal-footer">
    <button class="btn btn-primary" ng-click="save(form)">确认</button>
    <button class="btn btn-warning" ng-click="$dismiss()">取消</button>
</div>
